package com.lesama.test;

import java.util.Scanner;

public class StringTest1 {
    public static void main(String[] args) {
        checkCode();
    }
    public static void checkCode() {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入验证码");
        for (int i = 0; i < 3; i++) {
            String code = sc.next();
            if(sc.equals("abcd")) {
                System.out.println("验证码正确");
                break;
            } else {
                if(i == 2) {
                    System.out.println("很抱歉，您的次数已用尽");
                    break;
                }
                System.out.println("输入错误，请重试");
            }
        }
    }
}
